package cn.rongdao.jrkabao.test

import android.content.Context
import android.widget.ImageView
import cn.rongdao.jrkabao.R
import cn.rongdao.jrkabao.bean.main.personal.PersonItemInfoBean
import cn.rongdao.jrkabao.ui.main.mainfragment.personal.PersonInfoUIComponent
import com.mifengkong.frtools.util.FRImageLoad
import com.mifengkong.kotlincommon.recyclerview.adapter.BaseRecyclerCommonAdapter
import com.mifengkong.kotlincommon.recyclerview.adapter.BaseRecyclerCommonViewHolder

/**
 * Created by jack on 2018/6/25
 */
class TestPersonAdapter : BaseRecyclerCommonAdapter<PersonItemInfoBean> {

    constructor(context: Context) : super(context)

    override fun getLayoutRes(): Int {
        return R.layout.item_person
    }

    override fun convert(holder: BaseRecyclerCommonViewHolder, data: PersonItemInfoBean?, position: Int, payloads: List<Any>?) {
        (getView(R.id.ip_person_info) as PersonInfoUIComponent).setContent(data)
        holder.setImagePath(getView(R.id.ip_iv_avatar), object : BaseRecyclerCommonViewHolder.CommonImageLoader(data?.logo
                ?: "") {
            override fun loadImageView(imageView: ImageView, imagePath: String) {
                FRImageLoad.loadImage(imagePath, imageView)
            }
        })
    }
}